package com.baitiaojun.system.admin.mapper.permission;

import com.baitiaojun.common.enums.impl.StatusEnums;
import com.baitiaojun.mybatisplus.core.basemapper.MyBaseMapper;
import com.baitiaojun.system.admin.pojo.SysMenuDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

public interface MenuMapper extends MyBaseMapper<SysMenuDO> {
    Set<SysMenuDO> selectPermsByUserId(String userId);

    List<SysMenuDO> selectMenuTreeByRoleId(@Param("roleIds") List<Long> roleIds);

    default List<SysMenuDO> selectAll() {
        LambdaQueryWrapper<SysMenuDO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysMenuDO::getStatus, StatusEnums.NORMAL.getCode());
        return selectList(queryWrapper);
    }
}
